package top.huntwolf.admin.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import top.huntwolf.admin.pojo.orderEntity.Order;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

    @NotNull(message = "open_id cannot be null")
    private String openId;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date lastLogin;

    private String sessionKey;

    private String city;

    private String province;

    private String country;

    private String avatar;

    @Digits(integer = 1,fraction = 1,message = "gender should be 0 or 1")
    private Integer gender;

    private String nickname;

    private String role;

    @JsonIgnore
    private List<Order> orders;
}
